﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <!-- MetroStyles: TabControl -->
    <ControlTemplate x:Key="TopTabItem" TargetType="{x:Type TabControl}">
        <Border Background="{TemplateBinding Background}">
            <Grid KeyboardNavigation.TabNavigation="Local">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TabPanel 
                    Name="HeaderPanel"
                    Grid.Row="0"
                    Panel.ZIndex="1"
                    Margin="0,0,0,-1"
                    IsItemsHost="True"
                    KeyboardNavigation.TabIndex="1"
                    Background="Transparent"/>
                <Border 
                    Name="Border" 
                    Grid.Row="1" 
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="0,1,0,0"
                    KeyboardNavigation.TabNavigation="Local"
                    KeyboardNavigation.DirectionalNavigation="Contained"
                    KeyboardNavigation.TabIndex="2" >
                    <ContentPresenter 
                        Name="PART_SelectedContentHost"
                        ContentSource="SelectedContent" />
                </Border>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="#888888" />
                <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="BottomTabItem" TargetType="{x:Type TabControl}">
        <Border Background="{TemplateBinding Background}">
            <Grid KeyboardNavigation.TabNavigation="Local">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TabPanel 
                    Name="HeaderPanel"
                    Grid.Row="1"
                    Panel.ZIndex="1"
                    Margin="0,-1,0,0"
                    IsItemsHost="True"
                    KeyboardNavigation.TabIndex="1"
                    Background="Transparent"/>
                <Border 
                    Name="Border" 
                    Grid.Row="0" 
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="0,0,0,1"
                    KeyboardNavigation.TabNavigation="Local"
                    KeyboardNavigation.DirectionalNavigation="Contained"
                    KeyboardNavigation.TabIndex="2" >
                    <ContentPresenter 
                        Name="PART_SelectedContentHost"
                        ContentSource="SelectedContent" />
                </Border>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="#888888" />
                <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="LeftTabItem" TargetType="{x:Type TabControl}">
        <Border Background="{TemplateBinding Background}">
            <Grid KeyboardNavigation.TabNavigation="Local">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TabPanel 
                    Name="HeaderPanel"
                    Grid.Column="0"
                    Panel.ZIndex="1"
                    Margin="0,0,-1,0"
                    IsItemsHost="True"
                    KeyboardNavigation.TabIndex="1"
                    Background="Transparent"/>
                <Border 
                    Name="Border" 
                    Grid.Column="1" 
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="1,0,0,0"
                    KeyboardNavigation.TabNavigation="Local"
                    KeyboardNavigation.DirectionalNavigation="Contained"
                    KeyboardNavigation.TabIndex="2" >
                    <ContentPresenter 
                        Name="PART_SelectedContentHost"
                        ContentSource="SelectedContent" />
                </Border>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="#888888" />
                <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="RightTabItem" TargetType="{x:Type TabControl}">
        <Border Background="{TemplateBinding Background}">
            <Grid KeyboardNavigation.TabNavigation="Local">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TabPanel 
                    Name="HeaderPanel"
                    Grid.Column="1"
                    Panel.ZIndex="1"
                    Margin="-1,0,0,0"
                    IsItemsHost="True"
                    KeyboardNavigation.TabIndex="1"
                    Background="Transparent"/>
                <Border 
                    Name="Border" 
                    Grid.Column="0" 
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="0,0,1,0"
                    KeyboardNavigation.TabNavigation="Local"
                    KeyboardNavigation.DirectionalNavigation="Contained"
                    KeyboardNavigation.TabIndex="2" >
                    <ContentPresenter 
                        Name="PART_SelectedContentHost"
                        ContentSource="SelectedContent" />
                </Border>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="#888888" />
                <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Background" Value="Black"/>
        <Setter Property="BorderBrush" Value="#555"/>
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="TabStripPlacement" Value="Top" />
        <Setter Property="Template" Value="{StaticResource ResourceKey=TopTabItem}"/>
        <Style.Triggers>
            <Trigger Property="TabStripPlacement" Value="Top">
                <Setter Property="Template" Value="{StaticResource ResourceKey=TopTabItem}"/>
            </Trigger>
            <Trigger Property="TabStripPlacement" Value="Bottom">
                <Setter Property="Template" Value="{StaticResource ResourceKey=BottomTabItem}"/>
            </Trigger>
            <Trigger Property="TabStripPlacement" Value="Left">
                <Setter Property="Template" Value="{StaticResource ResourceKey=LeftTabItem}"/>
            </Trigger>
            <Trigger Property="TabStripPlacement" Value="Right">
                <Setter Property="Template" Value="{StaticResource ResourceKey=RightTabItem}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>